<script setup>
import zhCn from 'element-plus/dist/locale/zh-cn.mjs';
import router from "./router";
import { CreateCacheRoutes } from "~tools/RouterTool"
import MenuTool from "~tools/MenuTool.js";
import NavigatorTool from "~tools/NavigatorTool.js";
import api from "~api";
import {AppInit} from "~tools/AppTool";
import {HeaderNavigate} from "~tools/HeaderNavigate";

const { loadMenu, menuList, tapMenu } = MenuTool(router);
const {RouterBack,ListNavigator} = NavigatorTool(router,menuList);
const cacheRoutes = CreateCacheRoutes(router, menuList);

import {GetLang} from "~tools/LocaleTool";

AppInit();

let moduleId = "2c2878b08aa7367f018aa7a4b9c40007";//模块id
loadMenu(moduleId);

</script>

<template>
    <el-config-provider :locale="GetLang() == 'en-US'?null:zhCn">
        <BaseAppLayout>
            <template #header>
                <AppHeader  @toggle-item="HeaderNavigate" />
            </template>
            <template #menu>
                <LeftMenu @tap-menu="tapMenu" :list="menuList" :router="router"  :NavList="ListNavigator"></LeftMenu>
            </template>
            <template #navigator>
                <ZyNavigator :list="ListNavigator" @back="RouterBack" />
            </template>
            <router-view v-slot="{ Component }">
                <keep-alive :include="cacheRoutes" max="10">
                    <component :is="Component" />
                </keep-alive>
            </router-view>
        </BaseAppLayout>

    </el-config-provider>
</template>

<style scoped></style>
